package com.cpecc.controller.extra;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cpecc.mail.SendMailThread;
import com.cpecc.mail.SendMailThread1;
import com.cpecc.manager.system.EmailManager;
import com.cpecc.manager.system.HuanJieManager;
import com.cpecc.manager.system.RootManager;
import com.cpecc.manager.system.ShiYongZTManager;
import com.cpecc.manager.system.ToDoManager;
import com.cpecc.manager.system.UserManager;
import com.cpecc.manager.system.YouJianManager;
import com.cpecc.manager.wuzi.BaoFeiJLManager;
import com.cpecc.manager.wuzi.BaoFeiManager;
import com.cpecc.manager.wuzi.BaoFeiSPRManager;
import com.cpecc.manager.wuzi.BuPeiJLManager;
import com.cpecc.manager.wuzi.BuPeiManager;
import com.cpecc.manager.wuzi.CaiGouManager;
import com.cpecc.manager.wuzi.CaiGouSPRManager;
import com.cpecc.manager.wuzi.FenTanManager;
import com.cpecc.manager.wuzi.HuanHuoManager;
import com.cpecc.manager.wuzi.ShenQingJLManager;
import com.cpecc.manager.wuzi.ShenQingManager;
import com.cpecc.manager.wuzi.TuiHuoManager;
import com.cpecc.manager.wuzi.WeiXiuJLManager;
import com.cpecc.manager.wuzi.WeiXiuManager;
import com.cpecc.manager.wuzi.WuZiManager;
import com.cpecc.manager.wuzi.YiJiaoJLManager;
import com.cpecc.manager.wuzi.YiJiaoManager;
import com.cpecc.model.system.Email;
import com.cpecc.model.system.HuanJie;
import com.cpecc.model.system.ToDo;
import com.cpecc.model.system.User;
import com.cpecc.model.system.YouJian;
import com.cpecc.model.wuzi.BaoFei;
import com.cpecc.model.wuzi.BaoFeiJL;
import com.cpecc.model.wuzi.BaoFeiSPR;
import com.cpecc.model.wuzi.BuPei;
import com.cpecc.model.wuzi.BuPeiJL;
import com.cpecc.model.wuzi.CaiGouSPR;
import com.cpecc.model.wuzi.HuanHuo;
import com.cpecc.model.wuzi.ShenQing;
import com.cpecc.model.wuzi.ShenQingJL;
import com.cpecc.model.wuzi.TuiHuo;
import com.cpecc.model.wuzi.WeiXiu;
import com.cpecc.model.wuzi.WeiXiuJL;
import com.cpecc.model.wuzi.WuZi;
import com.cpecc.model.wuzi.YiJiao;
import com.cpecc.model.wuzi.YiJiaoJL;

@Controller
@RequestMapping(value = "/liucheng")
public class LiuChengController {
	
	@Autowired
	private ShenQingManager shenQingManager;
	
	@Autowired
	private HuanJieManager huanJieManager;
	
	@Autowired
	private WuZiManager wuZiManager;
	
	@Autowired
	private ShenQingJLManager shenQingJLManager;
	
	@Autowired
	private CaiGouSPRManager caiGouSPRManager;
	
	@Autowired
	private ToDoManager toDoManager;
	
	@Autowired
	private UserManager userManager;
	
	@Autowired
	private WeiXiuManager weiXiuManager;
	
	@Autowired
	private WeiXiuJLManager weiXiuJLManager;
	
	@Autowired
	private YiJiaoManager yiJiaoManager;
	
	@Autowired
	private YiJiaoJLManager yiJiaoJLManager;
	
	@Autowired
	private BaoFeiManager baoFeiManager;
	
	@Autowired
	private YouJianManager youJianManager;
	
	@Autowired
	private RootManager rootManager;
	
	@Autowired
	private EmailManager emailManager;
	
	@Autowired
	private BuPeiManager buPeiManager;
	
	@Autowired
	private HuanHuoManager huanHuoManager;
	
	@Autowired
	private TuiHuoManager tuiHuoManager;
	
	@Autowired
	private BaoFeiSPRManager baoFeiSPRManager;
	
	@Autowired
	private BaoFeiJLManager baoFeiJLManager;
	
	@Autowired
	private CaiGouManager caiGouManager;
	
	@Autowired
	private ShiYongZTManager shiYongZTManager;
	
	@Autowired
	private FenTanManager fenTanManager;
	
	@Autowired
	private BuPeiJLManager buPeiJLManager;
	
	@RequestMapping(value="/cuiBan1")
	public void cuiBan1(String id,HttpServletResponse response){
		YouJian youJian=youJianManager.get(3);
		if(youJian!=null){
			Email email=emailManager.getEmail();
			WuZi wuZi=wuZiManager.get(id);
			SendMailThread1 st=new SendMailThread1(email, wuZi.getUser(), youJian, wuZi);
			st.setRoot(rootManager.getRoot());
			Thread t=new Thread(st);
			t.start();
		}
	}
	
	@RequestMapping(value="/cuiBan")
	public void cuiBan(String id,int huanJie,HttpServletResponse response){
		Email email=emailManager.getEmail();
		String root=rootManager.getRoot();
		if(huanJie>100 && huanJie<200){
			ShenQing shenQing=shenQingManager.get(id);
			if(shenQing.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			if(huanJie==102){
				YouJian youJian=youJianManager.get(102);
				if(youJian!=null){
					for(CaiGouSPR caiGouSPR:caiGouSPRManager.list(id)){
						youJian=youJianManager.get(102);
						SendMailThread st=new SendMailThread(email, root, 102, caiGouSPR.getUser(), youJian);
						st.setCaiGouSPR(caiGouSPR);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==103){
				YouJian youJian=youJianManager.get(103);
				if(youJian!=null){
					for(User user1:userManager.getCGBMFZR()){
						youJian=youJianManager.get(103);
						SendMailThread st=new SendMailThread(email, root, 103, user1, youJian);
						st.setShenQing(shenQing);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==104){
				YouJian youJian=youJianManager.get(104);
				if(youJian!=null){
					youJian=youJianManager.get(104);
					SendMailThread st=new SendMailThread(email, root, 104, shenQing.getCaiMaiR(), youJian);
					st.setShenQing(shenQing);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==105){
				YouJian youJian=youJianManager.get(105);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(105);
						SendMailThread st=new SendMailThread(email, root, 105, user1, youJian);
						st.setShenQing(shenQing);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==106){
				YouJian youJian=youJianManager.get(106);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(106);
						SendMailThread st=new SendMailThread(email, root, 106, user1, youJian);
						st.setShenQing(shenQing);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==107){
				YouJian youJian=youJianManager.get(107);
				if(youJian!=null){
					WuZi wuZi=shenQing.getWuZi();
					User user=wuZi.getUser();
					SendMailThread st=new SendMailThread(email, root, 107, user, youJian);
					st.setShenQing(shenQing);
					st.setWuZi(wuZi);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==108){
				YouJian youJian=youJianManager.get(108);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(108);
						SendMailThread st=new SendMailThread(email, root, 108, user1, youJian);
						st.setShenQing(shenQing);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==109){
				YouJian youJian=youJianManager.get(109);
				if(youJian!=null){
					for(User user1:userManager.getCaiMaiR()){
						youJian=youJianManager.get(109);
						SendMailThread st=new SendMailThread(email, root, 109, user1, youJian);
						st.setShenQing(shenQing);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>200 && huanJie<300){
			HuanHuo huanHuo=huanHuoManager.get(id);
			if(huanHuo.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			WuZi wuZi=huanHuo.getWuZi();
			if(huanJie==202){
				YouJian youJian=youJianManager.get(202);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 202, wuZi.getCaiMaiR(), youJian);
					st.setWuZi(wuZi);
					st.setHuanHuo(huanHuo);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==203){
				YouJian youJian=youJianManager.get(203);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						SendMailThread st=new SendMailThread(email, root, 203, user1, youJian);
						st.setWuZi(huanHuo.getWuZi());
						st.setHuanHuo(huanHuo);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>300 && huanJie<400){
			TuiHuo tuiHuo=tuiHuoManager.get(id);
			if(tuiHuo.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			WuZi wuZi=tuiHuo.getWuZi();
			if(huanJie==302){
				YouJian youJian=youJianManager.get(302);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 302, wuZi.getCaiMaiR(), youJian);
					st.setWuZi(wuZi);
					st.setTuiHuo(tuiHuo);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==303){
				YouJian youJian=youJianManager.get(303);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(303);
						SendMailThread st=new SendMailThread(email, root, 303, user1, youJian);
						st.setWuZi(wuZi);
						st.setTuiHuo(tuiHuo);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>400 && huanJie<500){
			WeiXiu weiXiu=weiXiuManager.get(id);
			if(weiXiu.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			if(huanJie==402){
				YouJian youJian=youJianManager.get(402);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						SendMailThread st=new SendMailThread(email, root, 402, user1, youJian);
						st.setWeiXiu(weiXiu);
						st.setWuZi(weiXiu.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==403){
				YouJian youJian=youJianManager.get(403);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 403, weiXiu.getWeiXiuR(), youJian);
					st.setWeiXiu(weiXiu);
					st.setWuZi(weiXiu.getWuZi());
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==404){
				YouJian youJian=youJianManager.get(404);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 404, weiXiu.getUser(), youJian);
					st.setWeiXiu(weiXiu);
					st.setWuZi(weiXiu.getWuZi());
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==405){
				YouJian youJian=youJianManager.get(405);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						SendMailThread st=new SendMailThread(email, root, 405, user1, youJian);
						st.setWeiXiu(weiXiu);
						st.setWuZi(weiXiu.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>500 && huanJie<600){
			YiJiao yiJiao=yiJiaoManager.get(id);
			if(yiJiao.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			WuZi wuZi=yiJiao.getWuZi();
			if(huanJie==502){
				YouJian youJian=youJianManager.get(502);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(502);
						SendMailThread st=new SendMailThread(email, root, 502, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==503){
				YouJian youJian=youJianManager.get(503);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(503);
						SendMailThread st=new SendMailThread(email, root, 503, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==504){
				YouJian youJian=youJianManager.get(504);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 504, wuZi.getUser(), youJian);
					st.setYiJiao(yiJiao);
					st.setWuZi(wuZi);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==505){
				YouJian youJian=youJianManager.get(505);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(505);
						SendMailThread st=new SendMailThread(email, root, 505, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>600 && huanJie<700){
			YiJiao yiJiao=yiJiaoManager.get(id);
			if(yiJiao.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			WuZi wuZi=yiJiao.getWuZi();
			if(huanJie==602){
				YouJian youJian=youJianManager.get(602);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(602);
						SendMailThread st=new SendMailThread(email, root, 602, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}else if(huanJie>700 && huanJie<800){
			BaoFei baoFei=baoFeiManager.get(id);
			if(baoFei.getHuanJie().getId()!=huanJie){
				String result="{\"result\":\"success\"}";
				response.setContentType("application/json");
				try {
					response.getWriter().write(result);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return;
			}
			if(huanJie==702){
				YouJian youJian=youJianManager.get(702);
				if(youJian!=null){
					for(BaoFeiSPR baoFeiSPR:baoFeiSPRManager.getBuMenSRRList(id)){
						youJian=youJianManager.get(702);
						User user1=baoFeiSPR.getUser();
						SendMailThread st=new SendMailThread(email, root, 702, user1, youJian);
						st.setBaoFeiSPR(baoFeiSPR);
						st.setBaoFei(baoFei);
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==703){
				SendMailThread1 st1=new SendMailThread1(email, baoFei.getUser(), youJianManager.get(2), baoFei.getWuZi());
				Thread t1=new Thread(st1);
				t1.start();
			}else if(huanJie==704){

			}else if(huanJie==705){
				YouJian youJian=youJianManager.get(705);
				if(youJian!=null){
					for(User user1:userManager.getCGBMFZR()){
						youJian=youJianManager.get(705);
						SendMailThread st=new SendMailThread(email, root, 705, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==706){
				YouJian youJian=youJianManager.get(706);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(706);
						SendMailThread st=new SendMailThread(email, root, 706, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==707){
				YouJian youJian=youJianManager.get(707);
				if(youJian!=null){
					for(BaoFeiSPR baoFeiSPR:baoFeiSPRManager.getBuMenSRRList(id)){
						youJian=youJianManager.get(707);
						User user1=baoFeiSPR.getUser();
						SendMailThread st=new SendMailThread(email, root, 707, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiSPR(baoFeiSPR);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==708){
				YouJian youJian=youJianManager.get(708);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(708);
						SendMailThread st=new SendMailThread(email, root, 708, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==709){
				YouJian youJian=youJianManager.get(709);
				if(youJian!=null){
					for(User user1:userManager.getCGBMFZR()){
						SendMailThread st=new SendMailThread(email, root, 709, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==710){
				YouJian youJian=youJianManager.get(710);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 710, baoFei.getUser(), youJian);
					st.setBaoFei(baoFei);
					st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
					st.setWuZi(baoFei.getWuZi());
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==711){
				YouJian youJian=youJianManager.get(711);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(711);
						SendMailThread st=new SendMailThread(email, root, 711, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==712){
				YouJian youJian=youJianManager.get(712);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 712, baoFei.getCaiWuQRR(), youJian);
					st.setBaoFei(baoFei);
					st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
					st.setWuZi(baoFei.getWuZi());
					Thread t=new Thread(st);
					t.start();
				}
			}
		}else if(huanJie>800){
			BuPei buPei=buPeiManager.get(id);
			WuZi wuZi=buPei.getWuZi();
			if(huanJie==802){
				YouJian youJian=youJianManager.get(802);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(802);
						SendMailThread st=new SendMailThread(email, root, 802, user1, youJian);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==803){
				YouJian youJian=youJianManager.get(803);
				if(youJian!=null){
					SendMailThread st=new SendMailThread(email, root, 803, buPei.getUser(), youJian);
					st.setWuZi(wuZi);
					st.setBuPei(buPei);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==804){
				YouJian youJian=youJianManager.get(804);
				if(youJian!=null){
					for(User user1:userManager.getAllCaiWuR()){
						youJian=youJianManager.get(804);
						SendMailThread st=new SendMailThread(email, root, 804, user1, youJian);
						st.setWuZi(buPei.getWuZi());
						st.setBuPei(buPei);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==805){
				YouJian youJian=youJianManager.get(805);
				if(youJian!=null){
					for(User user1:userManager.getGZGLY()){
						youJian=youJianManager.get(805);
						SendMailThread st=new SendMailThread(email, root, 805, user1, youJian);
						st.setWuZi(buPei.getWuZi());
						st.setBuPei(buPei);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
		}
		String result="{\"result\":\"success\"}";
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 申请流程
	 */
	@RequestMapping(value = "/shenQingList")
	public ModelAndView shenQingList() {
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/shenQingList");
		return mav;
	}
	
	@RequestMapping(value = "/shenQingListAjax")
	public ModelAndView shenQingListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("shenQingList", shenQingManager.activeShenQing());
		mav.setViewName("liucheng/shenQingListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/sqYouJianListAjax")
	public ModelAndView sqYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(102, 109));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/sqHuiTui")
	public ModelAndView sqHuiTui(String id,int huanJie){
		ModelAndView mav=new ModelAndView();
		ShenQing shenQing=shenQingManager.get(id);
		if(shenQing.getHuanJie().getId()!=huanJie)
			return mav;
		else{
			List<HuanJie> huanJieList=new ArrayList<HuanJie>();
			if(huanJie==103){
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==104){
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==105){
				huanJieList.add(huanJieManager.get(104));
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==106){
				huanJieList.add(huanJieManager.get(105));
				huanJieList.add(huanJieManager.get(104));
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==107){
				huanJieList.add(huanJieManager.get(106));
				huanJieList.add(huanJieManager.get(105));
				huanJieList.add(huanJieManager.get(104));
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==108){
				huanJieList.add(huanJieManager.get(107));
				huanJieList.add(huanJieManager.get(106));
				huanJieList.add(huanJieManager.get(105));
				huanJieList.add(huanJieManager.get(104));
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}else if(huanJie==109){
				huanJieList.add(huanJieManager.get(108));
				huanJieList.add(huanJieManager.get(107));
				huanJieList.add(huanJieManager.get(106));
				huanJieList.add(huanJieManager.get(105));
				huanJieList.add(huanJieManager.get(104));
				huanJieList.add(huanJieManager.get(103));
				huanJieList.add(huanJieManager.get(102));
			}
			mav.addObject("shenQing", shenQingManager.get(id));
			mav.addObject("huanJieList", huanJieList);
			mav.setViewName("liucheng/sqHuiTui");
			return mav;
		}
	}
	
	@RequestMapping(value = "/sqHuiTuiSave")
	public void sqHuiTuiSave(String sqId,int hj,int huanJie,String huiTuiYY,HttpServletResponse response){
		String result="{\"result\":\"success\"}";
		ShenQing shenQing=shenQingManager.get(sqId);
		if(shenQing.getHuanJie().getId()!=hj)
			result="{\"result\":\"overdue\"}";
		else{
			Email email=emailManager.getEmail();
			String root=rootManager.getRoot();
			if(huanJie==102){
				if(shenQing.getWuZi()!=null){
					WuZi wuZi=shenQing.getWuZi();
					if(caiGouManager.list(wuZi)!=null){
						caiGouManager.deleteList(wuZi);
					}
					wuZiManager.delete(wuZi.getId());
					shenQing.setWuZi(null);
					shenQingManager.cover(shenQing);
				}
				toDoManager.deleteList(shenQing);
				
				List<User> shenPiUserList=shenQingJLManager.listBuMenSP(shenQing.getId());
				if(shenPiUserList!=null && shenPiUserList.size()>0){
					shenQing.setHuanJie(huanJieManager.get(102));
					int num=0;
					for(User u0:shenPiUserList){
						num++;
						CaiGouSPR caiGouSPR=new CaiGouSPR();
						caiGouSPR.setNo(0);
						caiGouSPR.setShenQing(shenQing);
						caiGouSPR.setUser(u0);
						caiGouSPRManager.save(caiGouSPR);
						
						ToDo toDo=new ToDo();
						toDo.setCreateDate(new Date());
						toDo.setHuanJie(huanJieManager.get(102));
						toDo.setShenQing(shenQing);
						toDo.setTask("部门审批");
						toDo.setType("申请采购");
						toDo.setUser(u0);
						toDoManager.save(toDo);
						//\\发送邮件
						YouJian youJian=youJianManager.get(102);
						if(youJian!=null && youJian.getState()==1){
							SendMailThread st=new SendMailThread(email, root, 102, u0, youJian);
							st.setCaiGouSPR(caiGouSPR);
							Thread t=new Thread(st);
							t.start();
						}
					}
					shenQing.setZongShu(num);
					shenQing.setDangQianShu(1);
					shenQingManager.cover(shenQing);
				}else{
					huanJie=103;
				}
			}
			if(huanJie==103){
				if(shenQing.getWuZi()!=null){
					WuZi wuZi=shenQing.getWuZi();
					if(caiGouManager.list(wuZi)!=null){
						caiGouManager.deleteList(wuZi);
					}
					wuZiManager.delete(wuZi.getId());
					shenQing.setWuZi(null);
					shenQingManager.cover(shenQing);
				}
				toDoManager.deleteList(shenQing);
				
				shenQing.setHuanJie(huanJieManager.get(103));
				for(User user1:userManager.getCGBMFZR()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(103));
					toDo.setShenQing(shenQing);
					toDo.setTask("选择采买人");
					toDo.setType("申请采购");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(103);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 103, user1, youJian);
						st.setShenQing(shenQing);
						Thread t=new Thread(st);
						t.start();
					}
				}
				shenQingManager.cover(shenQing);
			}else if(huanJie==104){
				if(shenQing.getWuZi()!=null){
					WuZi wuZi=shenQing.getWuZi();
					if(caiGouManager.list(wuZi)!=null){
						caiGouManager.deleteList(wuZi);
					}
					wuZiManager.delete(wuZi.getId());
					shenQing.setWuZi(null);
					shenQingManager.cover(shenQing);
				}
				toDoManager.deleteList(shenQing);
				
				shenQing.setHuanJie(huanJieManager.get(104));
				User u0=shenQing.getCaiMaiR();
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(104));
				toDo.setShenQing(shenQing);
				toDo.setTask("采买人审批");
				toDo.setType("申请采购");
				toDo.setUser(u0);
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(104);
				if(youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 104, u0, youJian);
					st.setShenQing(shenQing);
					Thread t=new Thread(st);
					t.start();
				}
				shenQingManager.cover(shenQing);
			}else if(huanJie==105){
				toDoManager.deleteList(shenQing);
				shenQing.setHuanJie(huanJieManager.get(105));
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(105));
					toDo.setShenQing(shenQing);
					toDo.setTask("物资入库");
					toDo.setType("申请采购");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(105);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 105, user1, youJian);
						st.setShenQing(shenQing);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				shenQingManager.cover(shenQing);
			}else if(huanJie==106){
				toDoManager.deleteList(shenQing);
				shenQing.setHuanJie(huanJieManager.get(106));
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(106));
					toDo.setShenQing(shenQing);
					toDo.setTask("物资发放");
					toDo.setType("申请采购");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(106);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 106, user1, youJian);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				shenQingManager.cover(shenQing);
			}else if(huanJie==107){
				toDoManager.deleteList(shenQing);
				shenQing.setHuanJie(huanJieManager.get(107));
				shenQingManager.cover(shenQing);
				WuZi wuZi=shenQing.getWuZi();
				User u0=wuZi.getUser();
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(107));
				toDo.setShenQing(shenQing);
				toDo.setTask("使用人验收");
				toDo.setType("申请采购");
				toDo.setUser(u0);
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(107);
				if(youJian!=null && youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 107, wuZi.getUser(), youJian);
					st.setWuZi(wuZi);
					st.setShenQing(shenQing);
					Thread t=new Thread(st);
					t.start();
				}
				shenQingManager.cover(shenQing);
			}else if(huanJie==108){
				toDoManager.deleteList(shenQing);
				shenQing.setHuanJie(huanJieManager.get(108));
				shenQingManager.cover(shenQing);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(108));
					toDo.setShenQing(shenQing);
					toDo.setTask("打印单据");
					toDo.setType("申请采购");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(108);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 108, user1, youJian);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==109){
				toDoManager.deleteList(shenQing);
				shenQing.setHuanJie(huanJieManager.get(109));
				shenQingManager.cover(shenQing);
				for(User user1:userManager.getAllCaiWuR()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(109));
					toDo.setShenQing(shenQing);
					toDo.setTask("财务确认");
					toDo.setType("申请采购");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(109);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 109, user1, youJian);
						st.setWuZi(shenQing.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
			ShenQingJL shenQingJL=new ShenQingJL();
			shenQingJL.setCaoZuoRQ(new Date());
			shenQingJL.setHuanJie(huanJieManager.get(hj));
			shenQingJL.setPiFuLX("采购流程回退");
			shenQingJL.setPiFuNR(huiTuiYY);
			shenQingJL.setShenQing(shenQing);
			Subject currentUser = SecurityUtils.getSubject();
			Object obj=currentUser.getPrincipals();
			String name=obj.toString();
			User user=userManager.findByUsername(name);
			shenQingJL.setUser(user);
			shenQingJLManager.save(shenQingJL);
		}
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 维修流程
	 */
	@RequestMapping(value = "/weiXiuList")
	public ModelAndView weiXiuList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/weiXiuList");
		return mav;
	}
	
	@RequestMapping(value = "/weiXiuListAjax")
	public ModelAndView weiXiuListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("weiXiuList", weiXiuManager.activeWeiXiu());
		mav.setViewName("liucheng/weiXiuListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/wxYouJianListAjax")
	public ModelAndView wxYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(402, 406));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/wxHuiTui")
	public ModelAndView wxHuiTui(String id,int huanJie){
		ModelAndView mav=new ModelAndView();
		WeiXiu weiXiu=weiXiuManager.get(id);
		if(weiXiu.getHuanJie().getId()!=huanJie)
			return mav;
		else{
			List<HuanJie> huanJieList=new ArrayList<HuanJie>();
			if(huanJie==403){
				huanJieList.add(huanJieManager.get(402));
			}else if(huanJie==404){
				huanJieList.add(huanJieManager.get(403));
				huanJieList.add(huanJieManager.get(402));
			}else if(huanJie==405){
				huanJieList.add(huanJieManager.get(404));
				huanJieList.add(huanJieManager.get(403));
				huanJieList.add(huanJieManager.get(402));
			}
			mav.addObject("huanJieList", huanJieList);
			mav.addObject("weiXiu", weiXiu);
			mav.setViewName("liucheng/wxHuiTui");
			return mav;
		}
	}
	
	@RequestMapping(value = "/wxHuiTuiSave")
	public void wxHuiTuiSave(String wxId,int hj,int huanJie,String huiTuiYY,HttpServletResponse response){
		String result="{\"result\":\"success\"}";
		WeiXiu weiXiu=weiXiuManager.get(wxId);
		if(weiXiu.getHuanJie().getId()!=hj)
			result="{\"result\":\"overdue\"}";
		else{
			Email email=emailManager.getEmail();
			String root=rootManager.getRoot();
			if(huanJie==402){
				weiXiu.setHuanJie(huanJieManager.get(402));
				toDoManager.deleteList(weiXiu);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(402));
					toDo.setWeiXiu(weiXiu);
					toDo.setTask("指定维修人");
					toDo.setType("维修流程");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(402);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 402, user1, youJian);
						st.setWeiXiu(weiXiu);
						st.setWuZi(weiXiu.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				weiXiuManager.cover(weiXiu);
			}else if(huanJie==403){
				weiXiu.setHuanJie(huanJieManager.get(403));
				toDoManager.deleteList(weiXiu);
				User u0=weiXiu.getWeiXiuR();
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(403));
				toDo.setWeiXiu(weiXiu);
				toDo.setTask("物资维修");
				toDo.setType("维修流程");
				toDo.setUser(u0);
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(403);
				if(youJian!=null && youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 403, weiXiu.getWeiXiuR(), youJian);
					st.setWeiXiu(weiXiu);
					st.setWuZi(weiXiu.getWuZi());
					Thread t=new Thread(st);
					t.start();
				}
				weiXiuManager.cover(weiXiu);
			}else if(huanJie==404){
				weiXiu.setHuanJie(huanJieManager.get(404));
				toDoManager.deleteList(weiXiu);
				WuZi wuZi=weiXiu.getWuZi();
				User u0=wuZi.getUser();
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(404));
				toDo.setWeiXiu(weiXiu);
				toDo.setTask("维修确认");
				toDo.setType("维修流程");
				toDo.setUser(u0);
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(404);
				if(youJian!=null && youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 404, u0, youJian);
					st.setWeiXiu(weiXiu);
					st.setWuZi(wuZi);
					Thread t=new Thread(st);
					t.start();
				}
				weiXiuManager.cover(weiXiu);
			}
			WeiXiuJL weiXiuJL=new WeiXiuJL();
			weiXiuJL.setCaoZuoRQ(new Date());
			weiXiuJL.setHuanJie(huanJieManager.get(hj));
			weiXiuJL.setPiFuLX("维修流程回退");
			weiXiuJL.setPiFuNR(huiTuiYY);
			Subject currentUser = SecurityUtils.getSubject();
			Object obj=currentUser.getPrincipals();
			String name=obj.toString();
			User user=userManager.findByUsername(name);
			weiXiuJL.setUser(user);
			weiXiuJL.setWeiXiu(weiXiu);
			weiXiuJLManager.save(weiXiuJL);
		}
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 移交流程
	 */
	@RequestMapping(value="/yiJiaoList")
	public ModelAndView yiJiaoList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/yiJiaoList");
		return mav;
	}
	
	@RequestMapping(value="/yiJiaoListAjax")
	public ModelAndView yiJiaoListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("yiJiaoList", yiJiaoManager.activeYiJiao());
		mav.setViewName("liucheng/yiJiaoListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/yjYouJianListAjax")
	public ModelAndView yjYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(502, 505));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	@RequestMapping(value="/yjHuiTui")
	public ModelAndView yjHuiTui(String id,int huanJie){
		ModelAndView mav=new ModelAndView();
		YiJiao yiJiao=yiJiaoManager.get(id);
		if(yiJiao.getHuanJie().getId()!=huanJie)
			return mav;
		else{
			List<HuanJie> huanJieList=new ArrayList<HuanJie>();
			if(huanJie==503){
				huanJieList.add(huanJieManager.get(502));
			}else if(huanJie==504){
				huanJieList.add(huanJieManager.get(503));
				huanJieList.add(huanJieManager.get(502));
			}else if(huanJie==505){
				huanJieList.add(huanJieManager.get(504));
				huanJieList.add(huanJieManager.get(503));
				huanJieList.add(huanJieManager.get(502));
			}
			mav.addObject("huanJieList", huanJieList);
			mav.addObject("yiJiao", yiJiao);
			mav.setViewName("liucheng/yjHuiTui");
			return mav;
		}
	}
	
	@RequestMapping(value="/yjHuiTuiSave")
	public void yjHuiTuiSave(String yjId,int hj,int huanJie,String huiTuiYY,HttpServletResponse response){
		String result="{\"result\":\"success\"}";
		YiJiao yiJiao=yiJiaoManager.get(yjId);
		if(yiJiao.getHuanJie().getId()!=hj)
			result="{\"result\":\"overdue\"}";
		else{
			Subject currentUser = SecurityUtils.getSubject();
			Object obj=currentUser.getPrincipals();
			String name=obj.toString();
			User user=userManager.findByUsername(name);
			Email email=emailManager.getEmail();
			String root=rootManager.getRoot();
			if(huanJie==502){
				yiJiao.setHuanJie(huanJieManager.get(502));
				toDoManager.deleteList(yiJiao);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(502));
					toDo.setYiJiao(yiJiao);
					toDo.setTask("固资管理员审批");
					toDo.setType("移交流程");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(502);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 502, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(yiJiao.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				yiJiaoManager.cover(yiJiao);
				WuZi wuZi=yiJiao.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(102));
				wuZi.setGuanLiBM(yiJiao.getYiJiaoR().getDep());
				wuZi.setDep(yiJiao.getYiJiaoR().getDep());
				wuZi.setUser(yiJiao.getYiJiaoR());
				fenTanManager.huiFuFenTan(wuZi);
				wuZiManager.cover(wuZi);
			}else if(huanJie==503){
				yiJiao.setHuanJie(huanJieManager.get(503));
				toDoManager.deleteList(yiJiao);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(503));
					toDo.setYiJiao(yiJiao);
					toDo.setTask("物资待发放");
					toDo.setType("移交流程");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(503);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 503, user1, youJian);
						st.setYiJiao(yiJiao);
						st.setWuZi(yiJiao.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				yiJiaoManager.cover(yiJiao);
				WuZi wuZi=yiJiao.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(105));
				YiJiaoJL yiJiaoJL=yiJiaoJLManager.lastGZGLY(yiJiao);
				wuZi.setUser(yiJiaoJL.getUser());
				wuZi.setGuanLiBM(yiJiaoJL.getUser().getDep());
				wuZi.setDep(yiJiaoJL.getUser().getDep());
				wuZiManager.cover(wuZi);
				fenTanManager.quChuFenTan(wuZi, new Date());
			}else if(huanJie==504){
				yiJiao.setHuanJie(huanJieManager.get(504));
				toDoManager.deleteList(yiJiao);
				WuZi wuZi=yiJiao.getWuZi();
				User u0=wuZi.getUser();
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(504));
				toDo.setYiJiao(yiJiao);
				toDo.setTask("新使用人待验收");
				toDo.setType("移交流程");
				toDo.setUser(u0);
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(504);
				if(youJian!=null && youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 504, u0, youJian);
					st.setYiJiao(yiJiao);
					st.setWuZi(wuZi);
					Thread t=new Thread(st);
					t.start();
				}
				yiJiaoManager.cover(yiJiao);
				wuZi.setShiYongZT(shiYongZTManager.get(105));
				YiJiaoJL yiJiaoJL=yiJiaoJLManager.lastGZGLY(yiJiao);
				wuZi.setUser(yiJiaoJL.getUser());
				wuZi.setGuanLiBM(yiJiaoJL.getUser().getDep());
				wuZi.setDep(yiJiaoJL.getUser().getDep());
				wuZiManager.cover(wuZi);
				fenTanManager.quChuFenTan(wuZi, new Date());
			}
			YiJiaoJL yiJiaoJL=new YiJiaoJL();
			yiJiaoJL.setCaoZuoRQ(new Date());
			yiJiaoJL.setHuanJie(huanJieManager.get(hj));
			yiJiaoJL.setPiFuLX("移交流程回退");
			yiJiaoJL.setPiFuNR(huiTuiYY);
			yiJiaoJL.setUser(user);
			yiJiaoJL.setYiJiao(yiJiao);
			yiJiaoJLManager.save(yiJiaoJL);
			yiJiaoManager.cover(yiJiao);
		}
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 报废流程
	 */
	@RequestMapping(value="/baoFeiList")
	public ModelAndView baoFeiList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/baoFeiList");
		return mav;
	}
	
	@RequestMapping(value="/baoFeiListAjax")
	public ModelAndView baoFeiListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("baoFeiList", baoFeiManager.activeBaoFei());
		mav.setViewName("liucheng/baoFeiListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/bfYouJianListAjax")
	public ModelAndView bfYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(702, 712));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	@RequestMapping(value="/bfHuiTui")
	public ModelAndView bfHuiTui(String id,int huanJie){
		ModelAndView mav=new ModelAndView();
		BaoFei baoFei=baoFeiManager.get(id);
		if(baoFei.getHuanJie().getId()!=huanJie)
			return mav;
		else{
			List<HuanJie> huanJieList=new ArrayList<HuanJie>();
			if(huanJie==703){
				huanJieList.add(huanJieManager.get(702));
			}else if(huanJie==704){
				huanJieList.add(huanJieManager.get(703));
				huanJieList.add(huanJieManager.get(702));
			}else if(huanJie==705){
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==706){
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==707){
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==708){
				huanJieList.add(huanJieManager.get(707));
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==709){
				huanJieList.add(huanJieManager.get(708));
				huanJieList.add(huanJieManager.get(707));
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==710){
				huanJieList.add(huanJieManager.get(709));
				huanJieList.add(huanJieManager.get(708));
				huanJieList.add(huanJieManager.get(707));
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==711){
				huanJieList.add(huanJieManager.get(710));
				huanJieList.add(huanJieManager.get(709));
				huanJieList.add(huanJieManager.get(708));
				huanJieList.add(huanJieManager.get(707));
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}else if(huanJie==712){
				huanJieList.add(huanJieManager.get(711));
				huanJieList.add(huanJieManager.get(710));
				huanJieList.add(huanJieManager.get(709));
				huanJieList.add(huanJieManager.get(708));
				huanJieList.add(huanJieManager.get(707));
				huanJieList.add(huanJieManager.get(706));
				huanJieList.add(huanJieManager.get(705));
				huanJieList.add(huanJieManager.get(704));
			}
			mav.addObject("huanJieList", huanJieList);
			mav.addObject("baoFei", baoFei);
			mav.setViewName("liucheng/bfHuiTui");
			return mav;
		}
	}
	
	@RequestMapping(value="/bfHuiTuiSave")
	public void bfHuiTuiSave(String bfId,int hj,int huanJie,String huiTuiYY,HttpServletResponse response){
		String result="{\"result\":\"success\"}";
		BaoFei baoFei=baoFeiManager.get(bfId);
		if(baoFei.getHuanJie().getId()!=hj)
			result="{\"result\":\"overdue\"}";
		else{
			Subject currentUser = SecurityUtils.getSubject();
			Object obj=currentUser.getPrincipals();
			String name=obj.toString();
			User user=userManager.findByUsername(name);
			Email email=emailManager.getEmail();
			String root=rootManager.getRoot();
			if(huanJie==702){
				List<User> bmsprList=baoFeiJLManager.listBuMen(baoFei);
				if(bmsprList!=null && bmsprList.size()>0){
					toDoManager.deleteList(baoFei);
					baoFei.setHuanJie(huanJieManager.get(702));
					baoFei.setDangQianS(1);
					WuZi wuZi=baoFei.getWuZi();
					wuZi.setShiYongZT(shiYongZTManager.get(102));
					wuZi.setUser(baoFei.getUser());
					wuZi.setGuanLiBM(baoFei.getUser().getDep());
					wuZi.setDep(baoFei.getUser().getDep());
					wuZiManager.cover(wuZi);
					int no=1;
					for(User user1:bmsprList){
						ToDo toDo=new ToDo();
						toDo.setCreateDate(new Date());
						toDo.setHuanJie(huanJieManager.get(702));
						toDo.setTask("部门审批");
						toDo.setType("报废");
						toDo.setUser(user1);
						toDo.setBaoFei(baoFei);
						toDoManager.save(toDo);
						BaoFeiSPR baoFeiSPR=new BaoFeiSPR();
						baoFeiSPR.setBaoFei(baoFei);
						baoFeiSPR.setUser(user1);
						baoFeiSPR.setNo(no);
						baoFeiSPRManager.save(baoFeiSPR);
						no++;
						//\\发送邮件
						YouJian youJian=youJianManager.get(702);
						if(youJian!=null && youJian.getState()==1){
							SendMailThread st=new SendMailThread(email, root, 702, user1, youJian);
							st.setBaoFeiSPR(baoFeiSPR);
							st.setBaoFei(baoFei);
							st.setWuZi(wuZi);
							Thread t=new Thread(st);
							t.start();
						}
					}
					baoFei.setZongRS(no-1);
					baoFeiManager.cover(baoFei);
				}else{
					huanJie=703;
				}
			}
			if(huanJie==703){
				toDoManager.deleteList(baoFei);
				baoFei.setHuanJie(huanJieManager.get(703));
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(102));
				wuZi.setUser(baoFei.getUser());
				wuZi.setGuanLiBM(baoFei.getUser().getDep());
				wuZi.setDep(baoFei.getUser().getDep());
				wuZiManager.cover(wuZi);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(703));
					toDo.setTask("固资管理员审批");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDo.setBaoFei(baoFei);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(703);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 703, user1, youJian);
						st.setBaoFei(baoFei);
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				SendMailThread1 st1=new SendMailThread1(email, baoFei.getUser(), youJianManager.get(2), baoFei.getWuZi());
				Thread t1=new Thread(st1);
				t1.start();
				baoFeiManager.cover(baoFei);
			}else if(huanJie==704){
				toDoManager.deleteList(baoFei);
				BaoFeiJL baoFeiJL=baoFeiJLManager.last(baoFei);
				baoFei.setHuanJie(huanJieManager.get(704));
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setGuanLiBM(baoFeiJL.getUser().getDep());
				wuZi.setDep(baoFeiJL.getUser().getDep());
				wuZi.setUser(baoFeiJL.getUser());
				wuZi.setShiYongZT(shiYongZTManager.get(106));
				wuZiManager.cover(wuZi);
				baoFeiManager.cover(baoFei);
			}else if(huanJie==705){
				baoFei.setHuanJie(huanJieManager.get(705));
				baoFeiManager.cover(baoFei);
				toDoManager.deleteList(baoFei);
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(107));
				wuZiManager.cover(wuZi);
				for(User user1:userManager.getCGBMFZR()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(705));
					toDo.setTask("资产管理部门领导审批");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDo.setBaoFei(baoFei);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(705);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 705, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==706){
				baoFei.setHuanJie(huanJieManager.get(706));
				baoFeiManager.cover(baoFei);
				toDoManager.deleteList(baoFei);
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(107));
				wuZiManager.cover(wuZi);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(706));
					toDo.setBaoFei(baoFei);
					toDo.setTask("发起会签");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(706);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 706, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==707){
				baoFei.setHuanJie(huanJieManager.get(707));
				toDoManager.deleteList(baoFei);
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(107));
				wuZiManager.cover(wuZi);
				List<User> huiQianList=baoFeiJLManager.listHuiQian(baoFei);
				if(huiQianList!=null && huiQianList.size()>0){
					int no=1;
					for(User user1:huiQianList){
						ToDo toDo=new ToDo();
						toDo.setCreateDate(new Date());
						toDo.setHuanJie(huanJieManager.get(707));
						toDo.setTask("报废会签");
						toDo.setType("报废");
						toDo.setUser(user1);
						toDo.setBaoFei(baoFei);
						toDoManager.save(toDo);
						BaoFeiSPR baoFeiSPR=new BaoFeiSPR();
						baoFeiSPR.setBaoFei(baoFei);
						baoFeiSPR.setUser(user1);
						baoFeiSPR.setNo(no);
						baoFeiSPRManager.save(baoFeiSPR);
						no++;
						//\\发送邮件
						YouJian youJian=youJianManager.get(707);
						if(youJian!=null && youJian.getState()==1){
							SendMailThread st=new SendMailThread(email, root, 707, user1, youJian);
							st.setBaoFei(baoFei);
							st.setBaoFeiSPR(baoFeiSPR);
							st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
							st.setWuZi(baoFei.getWuZi());
							Thread t=new Thread(st);
							t.start();
						}
					}
					baoFei.setDangQianS(1);
					baoFei.setZongRS(no-1);
					baoFeiManager.cover(baoFei);
				}else{
					huanJie=708;
				}
			}
			if(huanJie==708){
				baoFei.setHuanJie(huanJieManager.get(708));
				toDoManager.deleteList(baoFei);
				baoFei.setZongRS(0);
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(107));
				wuZiManager.cover(wuZi);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(708));
					toDo.setBaoFei(baoFei);
					toDo.setTask("报废物资处理");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(708);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 708, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
				baoFeiManager.cover(baoFei);
			}else if(huanJie==709){
				baoFei.setHuanJie(huanJieManager.get(709));
				toDoManager.deleteList(baoFei);
				baoFeiManager.cover(baoFei);
				for(User user1:userManager.getCGBMFZR()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(709));
					toDo.setTask("报废处理审批");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDo.setBaoFei(baoFei);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(709);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 709, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==710){
				toDoManager.deleteList(baoFei);
				WuZi wuZi=baoFei.getWuZi();
				wuZi.setShiYongZT(shiYongZTManager.get(107));
				wuZiManager.cover(wuZi);
				if(baoFei.getChuLiFS().equals("内购")){
					baoFei.setHuanJie(huanJieManager.get(710));
					baoFeiManager.cover(baoFei);
					ToDo toDo=new ToDo();
					toDo.setBaoFei(baoFei);
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(710));
					toDo.setTask("内购确认");
					toDo.setType("报废");
					toDo.setUser(baoFei.getUser());
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(710);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 710, baoFei.getUser(), youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}else{
					huanJie=711;
				}
			}
			if(huanJie==711){
				baoFei.setHuanJie(huanJieManager.get(711));
				toDoManager.deleteList(baoFei);
				baoFeiManager.cover(baoFei);
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setBaoFei(baoFei);
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(711));
					toDo.setTask("打印报废单据");
					toDo.setType("报废");
					toDo.setUser(user1);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(711);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 711, user1, youJian);
						st.setBaoFei(baoFei);
						st.setBaoFeiJL(baoFeiJLManager.last(baoFei));
						st.setWuZi(baoFei.getWuZi());
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
			BaoFeiJL baoFeiJL=new BaoFeiJL();
			baoFeiJL.setBaoFei(baoFei);
			baoFeiJL.setCaoZuoRQ(new Date());
			baoFeiJL.setHuanJie(huanJieManager.get(hj));
			baoFeiJL.setPiFuLX("报废流程回退");
			baoFeiJL.setPiFuNR(huiTuiYY);
			baoFeiJL.setUser(user);
			baoFeiJLManager.save(baoFeiJL);
		}
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 盘点流程
	 */
	@RequestMapping(value="/panDianList")
	public ModelAndView panDianList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/panDianList");
		return mav;
	}
	
	@RequestMapping(value="/panDianListAjax")
	public ModelAndView panDianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("wuZiList", wuZiManager.panDianList());
		mav.setViewName("liucheng/panDianListAjax");
		return mav;
	}
	
	@RequestMapping(value="/buPeiListAjax")
	public ModelAndView buPeiListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("buPeiList", buPeiManager.activeBuPei());
		mav.setViewName("liucheng/buPeiListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/pdYouJianListAjax")
	public ModelAndView pdYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(802, 804));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	@RequestMapping(value="/bpHuiTui")
	public ModelAndView bpHuiTui(String id,int huanJie){
		ModelAndView mav=new ModelAndView();
		BuPei buPei=buPeiManager.get(id);
		if(buPei.getHuanJie().getId()!=huanJie)
			return mav;
		else{
			List<HuanJie> huanJieList=new ArrayList<HuanJie>();
			if(huanJie==803){
				huanJieList.add(huanJieManager.get(802));
			}else if(huanJie==804){
				huanJieList.add(huanJieManager.get(803));
				huanJieList.add(huanJieManager.get(802));
			}else if(huanJie==805){
				huanJieList.add(huanJieManager.get(804));
				huanJieList.add(huanJieManager.get(803));
				huanJieList.add(huanJieManager.get(802));
			}
			mav.addObject("huanJieList", huanJieList);
			mav.addObject("buPei", buPei);
			mav.addObject("wuZi", buPei.getWuZi());
			mav.setViewName("liucheng/bpHuiTui");
			return mav;
		}
	}
	
	@RequestMapping(value="/bpHuiTuiSave")
	public void bpHuiTuiSave(String bpId,int hj,int huanJie,String huiTuiYY,HttpServletResponse response){
		String result="{\"result\":\"success\"}";
		BuPei buPei=buPeiManager.get(bpId);
		if(buPei.getHuanJie().getId()!=hj)
			result="{\"result\":\"overdue\"}";
		else{
			Subject currentUser = SecurityUtils.getSubject();
			Object obj=currentUser.getPrincipals();
			String name=obj.toString();
			User user=userManager.findByUsername(name);
			Email email=emailManager.getEmail();
			String root=rootManager.getRoot();
			if(huanJie==802){
				buPei.setHuanJie(huanJieManager.get(802));
				buPeiManager.cover(buPei);
				toDoManager.deleteList(buPei.getWuZi());
				for(User user1:userManager.getGZGLY()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(802));
					toDo.setTask("索赔");
					toDo.setType("资产盘点");
					toDo.setUser(user1);
					WuZi wuZi=buPei.getWuZi();
					toDo.setWuZi(wuZi);
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(802);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 802, user1, youJian);
						st.setWuZi(wuZi);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}else if(huanJie==803){
				buPei.setHuanJie(huanJieManager.get(803));
				buPeiManager.cover(buPei);
				toDoManager.deleteList(buPei.getWuZi());
				ToDo toDo=new ToDo();
				toDo.setCreateDate(new Date());
				toDo.setHuanJie(huanJieManager.get(803));
				toDo.setTask("索赔确认");
				toDo.setType("赔偿");
				toDo.setUser(buPei.getUser());
				toDo.setWuZi(buPei.getWuZi());
				toDoManager.save(toDo);
				//\\发送邮件
				YouJian youJian=youJianManager.get(803);
				if(youJian!=null && youJian.getState()==1){
					SendMailThread st=new SendMailThread(email, root, 803, buPei.getUser(), youJian);
					st.setWuZi(buPei.getWuZi());
					st.setBuPei(buPei);
					Thread t=new Thread(st);
					t.start();
				}
			}else if(huanJie==804){
				buPei.setHuanJie(huanJieManager.get(804));
				buPeiManager.cover(buPei);
				toDoManager.deleteList(buPei.getWuZi());
				for(User user1:userManager.getAllCaiWuR()){
					ToDo toDo=new ToDo();
					toDo.setCreateDate(new Date());
					toDo.setHuanJie(huanJieManager.get(804));
					toDo.setTask("赔偿入账");
					toDo.setType("赔偿");
					toDo.setUser(user1);
					toDo.setWuZi(buPei.getWuZi());
					toDoManager.save(toDo);
					//\\发送邮件
					YouJian youJian=youJianManager.get(804);
					if(youJian!=null && youJian.getState()==1){
						SendMailThread st=new SendMailThread(email, root, 804, user1, youJian);
						st.setWuZi(buPei.getWuZi());
						st.setBuPei(buPei);
						Thread t=new Thread(st);
						t.start();
					}
				}
			}
			BuPeiJL buPeiJL=new BuPeiJL();
			buPeiJL.setBuPei(buPei);
			buPeiJL.setCaoZuoRQ(new Date());
			buPeiJL.setHuanJie(huanJieManager.get(hj));
			buPeiJL.setPiFuLX("补赔流程回退");
			buPeiJL.setPiFuNR("盘点流程");
			buPeiJL.setUser(user);
			buPeiJLManager.save(buPeiJL);
		}
		response.setContentType("application/json");
		try {
			response.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * 退还流程
	 */
	@RequestMapping(value="/tuiHuanList")
	public ModelAndView tuiHuanList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/tuiHuanList");
		return mav;
	}
	
	@RequestMapping(value = "/tuiHuanYouJianListAjax")
	public ModelAndView tuiHuanYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(602, 602));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	/*
	 * 换货流程
	 */
	@RequestMapping(value="/huanHuoList")
	public ModelAndView huanHuoList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/huanHuoList");
		return mav;
	}
	
	@RequestMapping(value="/huanHuoListAjax")
	public ModelAndView huanHuoListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("huanHuoList", huanHuoManager.activeHuanHuo());
		mav.setViewName("liucheng/huanHuoListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/huanHuoYouJianListAjax")
	public ModelAndView huanHuoYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(202, 203));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
	
	/*
	 * 退货流程
	 */
	@RequestMapping(value="/tuiHuoList")
	public ModelAndView tuiHuoList(){
		ModelAndView mav=new ModelAndView();
		mav.setViewName("liucheng/tuiHuoList");
		return mav;
	}
	
	@RequestMapping(value="/tuiHuoListAjax")
	public ModelAndView tuiHuoListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("tuiHuoList", tuiHuoManager.activeTuiHuo());
		mav.setViewName("liucheng/tuiHuoListAjax");
		return mav;
	}
	
	@RequestMapping(value = "/tuiHuoYouJianListAjax")
	public ModelAndView tuiHuoYouJianListAjax(){
		ModelAndView mav=new ModelAndView();
		mav.addObject("youJianList", youJianManager.list(302, 303));
		mav.setViewName("liucheng/youJianListAjax");
		return mav;
	}
}
